def solve(strs):
    n = len(strs)
    if n == 0:
        return ""
    elif n == 1:
        return strs[0]

    m = len(strs[0])
    for j in range(m):
        ch = strs[0][j]
        for i in range(1, n):
            if len(strs[i]) >= j and strs[i][j] == ch:
                continue
            else:
                return strs[0][:j]

    return strs[0]


if __name__ == "__main__":
    # strs = ["flower", "flow", "flight"]
    strs = ["dog", "racecar", "car"]
    print(type(solve(strs)))
